package org.example
import scala.io.StdIn
object HelloScala {
  def main(args: Array[String]): Unit = {
    val name = "哪吒"
    println(name)
    var arr: Array[String] = Array("spark", "scala", "java", "python")
    println(arr.mkString("Array(", ", ", ")"))
    arr.foreach(println)
    class Phone(color: String, var price: Int, isOpen: Boolean) {
      def printInfo(): Unit = {
        println(color + " " + price + " " + isOpen + " ")
        println(s"该手机的颜色是$color,价格是$price,开机状态是$isOpen")
      }
    }
    val xiaomi = new Phone("white", 1299, true)
    xiaomi.printInfo()
    println("请输入接头暗号:")
    val word: String = StdIn.readLine()
    if (word == "好好学习") {
      println("暗号正确!")
    } else {
      println("暗号错误!")
    }

    def sayHello(name: String): Unit = {
      println("hello," + name)
    }

    sayHello("小哪吒")
    HelloScala.sayHi("哪吒2")
  }
    def sayHi (name: String): Unit = {
      println("Hi," + name)
    }
  }